﻿using System;
using eCommerce.core;
using eCommerce.db.BORespository;
using eCommerce.core.Helpers;

namespace eCommerce.web.Controls.Common
{
    public partial class NavigatorArticle : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var name = Utils.GetIdFromRequestString(Utils.Name, string.Empty);
                if (name == "lien-he")
                    Page.RegisterHiddenField("hidCategoryId", "9999");
                else if (name == "homepage" || name == string.Empty)
                    Page.RegisterHiddenField("hidCategoryId", "0000");
                else if (name == "san-pham-moi" )
                    Page.RegisterHiddenField("hidCategoryId", "0111");
                else if (name == "khuyen-mai")
                    Page.RegisterHiddenField("hidCategoryId", "0112");

                rptCategory.DataSource = CategoryBo.GetListByParentId((int)CategoryType.Article, (int)CategoryType.Root, (int)CategoryType.Active);
                rptCategory.DataBind();
            }
        }
    }
}